<template>
  <div>
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, index) in banner" :key="index">
        <img :src="item" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { getDetail } from "../../api/home";
import Vue from "vue";
import { Swipe, SwipeItem } from "vant";
Vue.use(Swipe);
Vue.use(SwipeItem);
export default {
  data() {
    return {
      banner: [],
    };
  },
  created() {
    getDetail(this.$route.params.proid).then((data) => {
      this.banner = data.data.data.banners[0].split(",");
      console.log(this.banner);
    });
  },
};
</script>

<style scoped>
.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.my-swipe {
  height: 3rem;
}
.my-swipe img {
  width: 100%;
}
</style>